<!-- html -->
<template>
  <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="客户名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入客户名称"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
</template>
<!-- 
    ts 
   setup  支持setup语法糖
-->
<script lang="ts" setup>
import {getCurrentInstance, reactive, ref, toRefs} from "vue";
const {proxy} = getCurrentInstance()

let props = defineProps({
  queryParams:{
    type:Object,
    default:null
  },
  showSearch:{
    type:Boolean,
    default:true
  }
})

let {queryParams,showSearch} = toRefs(props)

const emit = defineEmits(['handleQuery','resetQuery'])

//搜索按钮
const handleQuery = () => {
  emit('handleQuery')
}

//重置按钮
const resetQuery = () => {
  proxy.resetForm("queryRef")
  emit('resetQuery')
}

</script>
<!-- css样式 -->
<style scoped>
</style>